package com.example.demo.msg.nio;/**
 * Created by kete on 2018-08-10.
 */

/**
 * 作者：kete
 * 创建时间：2018-08-10 16:45
 * 功能描述：
 * 版本：
 */
public class SocketServer {

    public  static int port = 8888;

    private static ServerHandle serverHandle;

    public static void start(){
        start(port);
    }

    public static synchronized  void start(int port){
        if(serverHandle != null)
            serverHandle.stop();

        serverHandle = new ServerHandle(port);
        new Thread(serverHandle,"socketServer").start();
    }

    public static void main(String[] args) {
        SocketServer.start();
    }
}
